import '../../style/signV2.less';
import React, {Component} from 'react'
import {inject, observer} from 'mobx-react';
import { withRouter } from 'react-router-dom';
import { Tools } from 'weaver-mobile';
import CanNotAccess from '../CanNotAccess';
import Header from './Header';
import Content from './Content';
import Footer from './Footer';

const getLabel = Tools.getLabel;

@inject('signStoreV2')
@withRouter
@observer
export default class Sign extends Component {
  componentDidMount(){
    document.title = getLabel('513098','考勤打卡');
    this.init();
  }

  init = () => {
    const {signStoreV2: store} = this.props;
    store.redirectToOutsideSignApp = () => this.props.history.push({pathname: '/outSign'});
    store.init();
  }

  render() {
    const {signStoreV2: store} = this.props;

    if (store.baseInfo.showbutton == '0') {
      return (
        <CanNotAccess />
      )
    }

    return (
      <div className='hrm-sign-v2'>
        <Header store={store} />
        <Content store={store} />
        <Footer store={store} />
      </div>
    )
  }
}